<div id="topBox" class="myOrders">
	<h1 class="title"><?php echo $this->translate('myOrders')?></h1>
	<?php echo $this->MyFlashMessenger();?>
	<p class="info"><?php echo $this->translate('orderHistory')?></p>

	<?php	
	
	$now = Zend_Date::now();
	$now->addMinute( 15 );
	
	$link = isset($this->whiteLabelType) ? false : true;
	
	foreach ($this->pedidos as $pedido){
		
		$url = $this->url(array('idPedido'=>$pedido->idPedido), 'pedido');
		
		$fecha = new Zend_Date($pedido->fechaCreacion);
		
		if ($link){
		    $urlN = $this->url(array('negocioUrl'=>$pedido->getNegocio()->url), 'negocio');
		} else {
		    $urlN = $this->url(array(), 'negocio');
		}
		
		$madeOn = sprintf($this->translate('orderMadeOn'), $fecha->toString(Zend_Date::DATE_LONG), $fecha->toString(Zend_Date::TIME_MEDIUM));
		
		$negocio = $pedido->getNegocio();
		
		
		echo "<div class='order'>
					<div class='right'>
						<p class='date'>{$this->translate('date')}: <span>{$fecha->toString(Zend_Date::DATE_MEDIUM)}</span></p>
						<p class='status'>{$this->translate('status')}:  <span>{$pedido->getEstado()}</span></p>
						<p class='price'>{$this->translate('total')}: <span>$ ".(number_format($pedido->precioFinal,2))."</span></p>
					</div>
					<a class='number' href='{$url}'>{$pedido->idPedido}</a>
					<a class='showDetail' href='{$url}'>".$this->translate('seeDetail')."</a>
					<p class='name'><a href='$urlN'>{$negocio->nombre}</a></p>
					<p class='street'>{$negocio->getDireccion()}</p>
				</div>";
		
		if ( $pedido->estado == Delivery_Model_Pedido::PEDIDO ){
		    
			
			$fechaCancelacion = new Zend_Date( $pedido->fechaCancelacion );
			
			$waitForOrderConfirmation = $fechaCancelacion->isLater( $now ) ? false : true;
			
			if( $waitForOrderConfirmation ){
			
				$this->JQuery()->onLoadCaptureStart();
			    
			    echo "waitForOrderConfirmation( {$pedido->idPedido} );";
			    
			    $this->JQuery()->onLoadCaptureEnd();
		    
			}
		}
		
		
		
	}		

	?>
</div>
<?php
if ( !isset($this->whiteLabelType )){
    $this->renderToPlaceholder('side/box-info-help.phtml','side');
} else {
    $this->renderToPlaceholder('negocio/side-white-label.phtml','side');
}
$this->renderToPlaceholder('side/tip-mydata.phtml','side');

$this->headTitle()->append( $this->translate('meta-title-my-orders') );
$this->headMeta()->appendName('keywords', $this->translate('meta-keywords-my-orders') );
$this->headMeta()->appendName('description', $this->translate('meta-description-my-orders'));